<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateUsersTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique('name');
            $table->string('phone')->nullable()->unique();
            $table->string('email')->nullable()->unique();
            $table->string('password')->nullable();
            $table->string('remember_token', 100)->nullable();
            $table->string('avatar')->nullable();
            $table->string('introduction')->nullable();
            $table->string('status')->default('1')->comment('状态');
            $table->integer('type')->default(0)->comment('用户类型（0：系统用户；1：代理；2：网站）');
            $table->integer('notification_count')->unsigned()->nullable()->default(0);
            $table->string('backend_ips',1024)->nullable()->comment('后台IP白名单');
            $table->string('api_ips',1024)->nullable()->comment('接口IP白名单');
            $table->string('last_ip')->nullable()->comment('最后一次登录IP');
            $table->string('last_location')->nullable()->comment('最后一次登录地址');
            $table->dateTime('last_time')->nullable()->comment('最后一次登录时间');
            $table->softDeletes();
            $table->timestamps();
        }
        );
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }

}
